//
//  Tools.h
//  TianXingPlanet
//
//  Created by Zeaple on 15/8/12.
//  Copyright (c) 2015年 Zyii. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^afterResultBlock)(NSDictionary *resultDic);
typedef void(^errorActionBlock)(NSError *error);
typedef void(^checkVersionBlock)(NSDictionary *infoDic);

@interface Tools : NSObject

#pragma mark - JsonDataToString

+ (NSString *)stringConvertToJsonString:(id)aString;

#pragma mark - HUD


#pragma mark - ViewController

+(void)popViewControllerAfterDelay:(NSInteger)delay WithController:(UIViewController *)viewController;

+(void)dismissViewControllerAfterDelay:(NSInteger)delay WithController:(UIViewController *)viewController;

+(NSString *)transferPhoneNumToSecretTypeWithNum:(NSString *)phoneNum;

#pragma mark - AFNetworking

//不带参数的get请求
+ (void)AFNetworkingRequestTypeGETWithUrl:(NSString *)url  afterResultBlock:(afterResultBlock)resultAct;
//带参数get请求
+ (void)AFNetworkingRequestTypeGETWithUrl:(NSString *)url paramters:(id)paramters afterResultBlock:(afterResultBlock)resultAct;
//多参数Get请求
+ (void)AFNetworkingRequestTypeGetWithUrl:(NSString *)url MultiParamters:(id)paramters afterResultBlock:(afterResultBlock)resultAct;
//自行处理错误信息
+ (void)AFNetworkingRequestTypeGETWithUrl:(NSString *)url paramters:(id)paramters afterResultBlock:(afterResultBlock)resultAct handleErrorBlock:(errorActionBlock)errorAct;

/*post*/
+ (void)AFNetworkingRequestTypePostWithUrl:(NSString *)url paramters:(id)paramters afterResultBlock:(afterResultBlock)resultAct;
+ (void)AFNetworkingRequestTypePostWithUrl:(NSString *)url paramters:(id)paramters afterResultBlock:(afterResultBlock)resultAct handleErrorBlock:(errorActionBlock)errorAct;
//上传头像
+ (void)AFNetworkingUploadImage:(NSData *)imageData withUrl:(NSString*)url paramters:(id)paramters afterResultBlock:(afterResultBlock)resultAct;

//取消网络请求
+ (void)cancelAllNetworkRequests;

+ (NSString *)MD5:(NSString *)str;
@end
/*******匹配正则表达式*************/
@interface Tools (matchRegex)
+ (BOOL)regexWithText:(NSString*)text regex:(NSString*)regex;
//1,验证输入的内容是否是中文
+ (BOOL)isChinese:(NSString*)text;
//2,验证身份证号码格式
+ (BOOL)isRightIDNumber:(NSString*)idNumber;
//3,验证手机号码格式
+ (BOOL)isRightMobileNumber:(NSString*)mobileNumber;
@end


/******判断网络是否可用***********/
@interface Tools (isNetworkReachability)
+ (BOOL)isNetworkReachability;
@end

////手势密码
//@interface Tools (GesturePassword)
////向本地保存手势安全密码
//+ (void)saveGesturePassword:(NSString*)password;
////从本地获取安全密码
//+ (NSString*)getGesturePassword;
////验证绘制的手势密码
//+ (BOOL)isSameTolocalPasswordCompareWithPassword:(NSString*)password;
////绘制次数达到5次，手势密码失效，移除手势密码
//+ (void)removeGesturePassword;
////手势密码删除后再次使用都是无效的
//+ (NSString*)valideGesturePassword;
//@end



